'use strict';
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event)
	const db = uniCloud.database({});
	const shop = db.collection('db_shop_bag')
	//返回数据给客户端
	let Y = new Date().getFullYear()
	let M = new Date().getMonth() + 1
	let D = new Date().getDate()
	let h = new Date().getHours() < 10 ? "0" + new Date().getHours() : new Date().getHours()
	let m = new Date().getMinutes() < 10 ? "0" + new Date().getMinutes() : new Date().getMinutes()
	let s = new Date().getSeconds() < 10 ? "0" + new Date().getSeconds() : new Date().getSeconds()
	let dt = Y + "-" + M + "-" + D + " " + h + ":" + m + ":" + s
	// console.log(Y + "-" + M + "-" + D + " " + h + ":" + m + ":" + s, 456456)
	return await shop.add({
		item_id: event.con,
		count: event.count,
		uid: event.uid,
		type: event.type,
		create_time: dt
	})
};